<?php

class ControleAcao implements IObject {

    private $IDControleAcao;
    private $IDAcao;
    private $StController;
    private $StAction;
    private $StParam;

    public function __construct($ArDadosControleAcao) {
        $this->IDControleAcao = !empty($ArDadosControleAcao['IDControleAcao']) ? $ArDadosControleAcao['IDControleAcao'] : '';
        $this->IDAcao = !empty($ArDadosControleAcao['IDAcao']) ? $ArDadosControleAcao['IDAcao'] : '';
        $this->StController = $ArDadosControleAcao['StController'];
        $this->StAction = $ArDadosControleAcao['StAction'];
        $this->StParam = $ArDadosControleAcao['StParam'];
    }

    public function getRestrictParams() {
        if( empty($this->StParam) ) { return false; }
        $ArRestrictParams = explode('=', $this->StParam);
        return array('Restriction' => $ArRestrictParams[0], 'Value' => $ArRestrictParams[1]);
    }

    public function isFilter() {
        return $this->StAction == 'filter' || $this->StAction == 'date-filter';
    }

    public function equals(IObject $Object) {
        return $Object->getStController() == $this->StController && replaceUrlFriendlyToAction($Object->getStAction()) == replaceUrlFriendlyToAction($this->StAction);
    }

    public function getStParam() {
        return $this->StParam;
    }

    public function getStController() {
        return $this->StController;
    }

    public function getStAction() {
        return $this->StAction;
    }

}

?>
